<script setup lang="ts">
import { ref } from 'vue'
import {  onUnload } from '@dcloudio/uni-app'
const props = defineProps<{
  deviceId: string
}>()
const connectBLEsucess = ref(true)
const sensorCalibrate = () => {
  uni.navigateTo({
    url: `/pagesDevice/calibrate-equipment/sensor-calibrate/sensor-calibrate?deviceNum=${props.deviceId}`,
  })
}
const calibrateBlood = () => {
  uni.navigateTo({
    url: `/pagesDevice/calibrate-equipment/calibrate-blood/calibrate-blood?deviceNum=${props.deviceId}`,
  })
}
const back = () => {
  connectBLEsucess.value = false
  uni.navigateBack({
    delta: 1,
  })
}
onUnload(() => {
  if (connectBLEsucess.value === true) return
  uni.closeBluetoothAdapter({
    success: (res) => {
      console.log(res + '关闭蓝牙')
    },
    fail: (err) => {},
  })
})
</script>
<template>
  <view class="content">
    <view class="title">
      <u-icon name="arrow-left" color="#ffff" size="22" @click="back"></u-icon>
      校准设备</view>
    <view class="info-box">
      <u-cell-group :border="false">
        <u-cell title="传感器校准" is-link @click="sensorCalibrate"></u-cell>
        <u-cell title="校准血压" is-link @click="calibrateBlood"></u-cell>
      </u-cell-group>
    </view>
  </view>
</template>
<style lang="scss">
page {
  height: 100%;
  font-family: PingFangSC-regular;
  .content {
    height: 100%;
    display: flex;
     flex-direction: column;
    background: url(@/static/starry2.png) no-repeat;
    background-size: contain;
    .title {
      position: relative;
      padding-top: 115.385rpx;
      padding-bottom: 28.846rpx;
      font-size: 34.615rpx;
      color: #ffff;
      text-align: center;
      .u-icon {
        position: absolute;
        left: 3%;
      }
    }
    .info-box {
      width: 100%;
      padding: 19.231rpx 28.846rpx;
      box-sizing: border-box;
    }
  }
}
</style>
